package com.naiterui.ehp.bs.patient.controller;

import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bp.support.context.ResourceHolder;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bp.support.security.SettingConfig;
import com.naiterui.ehp.bs.patient.service.IConsultComplaintService;
import com.naiterui.ehp.bs.patient.vo.comment.ComplaintParamVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description 患者会话投诉
 * @Author gongbaoqiang
 * @Date 2020/6/30 10:34 AM
 */
@Slf4j
@Api(tags = {SwaggerTag.PATIENT + SwaggerTag.CONSULT_COMMENT})
@RestController
@RequestMapping("ap/patient/consult/complaint")
public class ApPatientConsultComplaintController {

    @Autowired
    private IConsultComplaintService complaintService;

    @ApiOperation( value = "提交投诉")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "patientId", value = "患者id", required = true, dataType = "long", paramType = "query")
    })
    @PostMapping("submit")
    public void submitComplaint(Long patientId, ComplaintParamVO paramVO) throws BusinessException{
        if (null == patientId) {
            patientId = (Long) ResourceHolder.getResource(SettingConfig.PATIENT_ID);
        }
        log.info("提交投诉： patientId={}, paramVo={}", patientId, paramVO.toString());
        complaintService.submit(patientId, paramVO);
    }



}
